package com.example.a02back.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.example.a02back.entity.ChatRoom;
import com.example.a02back.mapper.ChatRoomMapper;
import com.example.a02back.service.IChatRoomService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author SimpChaos
 * @since 2022-07-21
 */
@Service
public class ChatRoomServiceImpl extends ServiceImpl<ChatRoomMapper, ChatRoom> implements IChatRoomService {

    public ChatRoom start(String uid,String swapper,String sid){
        ChatRoom room = new ChatRoom();
        room.setRoomId(RandomUtil.randomNumbers(24));
        room.setUid(uid);
        room.setSid(sid);
        room.setSwapper(swapper);
        this.save(room);
        return room;

    }

}
